package library;

import java.io.Serializable;
import java.util.Observable;

public class Student
extends Observable
implements Serializable, Comparable<Student>
{
	private static final long serialVersionUID = -1263064717112311461L;
	
	private String name;
	private int id;
	
	public Student(int id, String name)
	{
		this.id = id;
		this.name = name;
	}
	
	public int getId()
	{
		return id;
	}
	
	public String getName()
	{
		return name;
	}

	@Override
	public String toString()
	{
		return("Student [" + id + ", " + name + "]");
	}

	
	
	@Override
	public boolean equals(Object obj)
	{
		if (obj instanceof Student)
			return this.id == ((Student)obj).id;
		else
			return false;
	}

	@Override
	public int hashCode()
	{
		return(id + name.hashCode());
	}

	@Override
	public int compareTo(Student other)
	{
		return this.id - other.id;
	}
	
	
}
